package fun.coding.inheritance;

public class TestClass {
    int a;
    int b;

    public TestClass() {
        a = 5;
        b = 6;
        print();
    }

    public void print() {
        System.out.println(this.getClass() + ": a:" + a + ", b:" + b);
    }

    public static void main(String[] args) {
        TestClass test1 = new TestClass();
        TestClass test2 = new TestClass2();
        TestClass test3 = new TestClass3();
    }

}

class TestClass2 extends TestClass {
    public TestClass2() {
        super();
        a = 1;
        b = 2;
        print();
    }

    public void print() {
        System.out.println(this.getClass() + ": a:" + a + ", b:" + b);
    }
}

class TestClass3 extends TestClass2 {
    public TestClass3() {
        print();
    }

    public void print() {
        System.out.println(this.getClass() + ": a:" + a + ", b:" + b);
    }
}
